<template>
    <div class="content u-padding-0">
        <iframe width="100%" frameborder="0" style="width: 100%; height: 100%;"
            v-if ="src" :src="pdfSrc"></iframe>
            pdfjs
    </div>
</template>

<script>
    export default {
        components: {


        },
        props: {
          src: {
            type: String,
          },
        },
        data() {
            return {
                pdfSrc: '',
                viewerUrl: '/static/pdfjs/web/viewer.html',


            };
        },
        mounted: function() {
            this.loadPDF();
        },
        methods: {
            loadPDF() {

                //pdfSrc ：pdf存放的文件路径，可以是本地的，也可以是远程，这个是远程的，亲测可以用，用决对路径避免打包404
                //ie有缓存加个随机数解决 + '?r=' + new Date()
                this.pdfSrc=`${this.viewerUrl}?file=${encodeURIComponent(this.src)}`

            },
        },

    };
</script>

<style lang="scss" scoped>
    .order {

        /deep/.u-table {
            .u-tr,
            .u-td {
                height: 45px;
                line-height: 45px;
            }
        }
    }
</style>
